package model;

public class Item implements Comparable<Item> {
	private long idItem;
	private String nameItem;
	private double priceItem;
	private String avatarItem;
	
	public Item(long idItem, String nameItem, double priceItem,
			String avatarItem) {
		super();
		this.idItem = idItem;
		this.nameItem = nameItem;
		this.priceItem = priceItem;
		this.avatarItem = avatarItem;
	}
	public long getIdItem() {
		return idItem;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((avatarItem == null) ? 0 : avatarItem.hashCode());
		result = prime * result + (int) (idItem ^ (idItem >>> 32));
		result = prime * result
				+ ((nameItem == null) ? 0 : nameItem.hashCode());
		long temp;
		temp = Double.doubleToLongBits(priceItem);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Item other = (Item) obj;
		if(this.idItem != other.idItem){
			return false;
		}
		return true;
	}
	public void setIdItem(long idItem) {
		this.idItem = idItem;
	}
	public String getNameItem() {
		return nameItem;
	}
	public void setNameItem(String nameItem) {
		this.nameItem = nameItem;
	}
	public double getPriceItem() {
		return priceItem;
	}
	public void setPriceItem(double priceItem) {
		this.priceItem = priceItem;
	}
	public String getAvatarItem() {
		return avatarItem;
	}
	public void setAvatarItem(String avatarItem) {
		this.avatarItem = avatarItem;
	}
	@Override
	public int compareTo(Item o) {
		return (int) (this.idItem - o.idItem);
	}

}
